package main

import (
	"fmt"
	"sync"
)

var wg sync.WaitGroup

func routine1() {
	defer wg.Done()
	fmt.Println("routine1")
}
func routine2() {
	defer wg.Done()
	fmt.Println("routine2")
}
func routine3() {
	defer wg.Done()
	fmt.Println("routine3")
}

func main() {
	wg.Add(3)
	go routine1()
	go routine2()
	go routine3()
	wg.Wait()
	fmt.Println("main end ....")
}
